package com.zhijian.medical.controller;

import com.zhijian.medical.entity.vo.request.RoutinePatientDiagnoseReportSaveOrUpdateVo;
import com.zhijian.medical.entity.vo.request.RoutinePatientDiagnoseReportSearchVo;
import com.zhijian.medical.entity.vo.response.*;
import com.zhijian.medical.service.RoutinePatientDiagnoseReportService;
import com.zhijian.response.annotation.Response;
import com.zhijian.util.page.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 诊断-结构化报告 控制层
 *
 * @author auto
 * @version 1.0
 * @date 2024-11-29 17:36:35
 */
@Slf4j
@Controller
@Api(tags = "诊断-结构化报告")
public class RoutinePatientDiagnoseReportController {

    @Autowired
    private RoutinePatientDiagnoseReportService service;

    /**
     * 新增
     *
     * @param param
     * @return
     */
    @Response
    @PostMapping("/routine/patient/diagnose/report")
    @ApiOperation("新增")
    public boolean insert(@RequestBody RoutinePatientDiagnoseReportSaveOrUpdateVo param) {
        log.info("{} - {}| insert info", this.getClass().getSimpleName(), param);
        return service.save(param);
    }

    /**
     * 删除
     *
     * @param id
     * @return
     */
    @Response
    @DeleteMapping("/routine/patient/diagnose/report/{id}")
    @ApiOperation("删除")
    public boolean delete(@PathVariable("id") Long id) {
        log.info("{} - {}| delete info", this.getClass().getSimpleName(), id);
        service.deleteById(id);
        return true;
    }

    /**
     * 修改
     *
     * @param id
     * @param param
     * @return
     */
    @Response
    @PutMapping("/routine/patient/diagnose/report/{id}")
    @ApiOperation("修改")
    public boolean update(@PathVariable("id") Long id, @RequestBody RoutinePatientDiagnoseReportSaveOrUpdateVo param) {
        log.info("{} - {}| update info, {}", this.getClass().getSimpleName(), id, param);
        param.setId(id);
        return service.modify(param);
    }

    /**
     * 根据id查询
     *
     * @param id
     * @return
     */
    @Response
    @GetMapping("/routine/patient/diagnose/report/{id}")
    @ApiOperation("根据id查询")
    public RoutinePatientDiagnoseReportVo selectById(@PathVariable("id") Long id) {
        log.info("{} - {}| query info", this.getClass().getSimpleName(), id);
        return service.selectVoById(id);
    }

    /**
     * 分页查询
     *
     * @param param
     * @return
     */
    @Response
    @PostMapping("/routine/patient/diagnose/report/page")
    @ApiOperation("分页查询")
    public Page<RoutinePatientDiagnoseReportVo> selectByCondition(@RequestBody(required = false) RoutinePatientDiagnoseReportSearchVo param) {
        if (param == null)
            param = RoutinePatientDiagnoseReportSearchVo.builder().build();
        log.info("{} - {}| query info", this.getClass().getSimpleName(), param);
        return service.selectPage(param);
    }

    /**
     * 列表查询
     *
     * @param param
     * @return
     */
    @Response
    @PostMapping("/routine/patient/diagnose/report/list")
    @ApiOperation("列表查询")
    public List<RoutinePatientDiagnoseReportVo> selectList(@RequestBody(required = false) RoutinePatientDiagnoseReportSearchVo param) {
        if (param == null)
            param = RoutinePatientDiagnoseReportSearchVo.builder().build();
        log.info("{} - {}| query info", this.getClass().getSimpleName(), param);
        return service.selectList(param);
    }

    /**
     * 批量删除
     *
     * @param idList
     * @return
     */
    @Response
    @DeleteMapping("/routine/patient/diagnose/report/list")
    @ApiOperation("批量删除")
    public boolean delete(@RequestBody(required = false) List<Long> idList) {
        log.info("{} - {}| delete info", this.getClass().getSimpleName(), idList);
        service.deleteByIdList(idList);
        return true;
    }

    @Response
    @GetMapping("/routine/patient/diagnose/report/option")
    @ApiOperation("获取报告选项")
    public RoutinePatientDiagnoseReportOptionVo getOption() {
        return service.getOption();
    }

    @Response
    @GetMapping("/routine/patient/diagnose/report/esophagus/option")
    @ApiOperation("获取食道癌选项")
    public RoutinePatientDiagnoseReportEsophagusOptionVo getEsophagusOption() {
        return service.getEsophagusOption();
    }

    @Response
    @GetMapping("/routine/patient/diagnose/report/stomach/option")
    @ApiOperation("获取胃癌选项")
    public RoutinePatientDiagnoseReportStomachOptionVo getStomachOption() {
        return service.getStomachOption();
    }

    @Response
    @GetMapping("/routine/patient/diagnose/report/colorectal/option")
    @ApiOperation("获取直肠癌选项")
    public RoutinePatientDiagnoseReportColorectalOptionVo getColorectalOption() {
        return service.getColorectalOption();
    }

    @Response
    @GetMapping("/routine/patient/diagnose/report/liver/option")
    @ApiOperation("获取肝癌选项")
    public RoutinePatientDiagnoseReportLiverOptionVo getLiverOption() {
        return service.getLiverOption();
    }

    @Response
    @GetMapping("/routine/patient/diagnose/report/pancreatic/option")
    @ApiOperation("获取胰胆壶腹癌选项")
    public RoutinePatientDiagnoseReportPancreaticOptionVo getPancreaticOption() {
        return service.getPancreaticOption();
    }

    @Response
    @GetMapping("/routine/patient/diagnose/report/lungs/option")
    @ApiOperation("获取肺癌选项")
    public RoutinePatientDiagnoseReportLungsOptionVo getLungsOption() {
        return service.getLungsOption();
    }

    @Response
    @GetMapping("/routine/patient/diagnose/report/breast/option")
    @ApiOperation("获取乳腺癌选项")
    public RoutinePatientDiagnoseReportBreastOptionVo getBreastOption() {
        return service.getBreastOption();
    }

    @Response
    @GetMapping("/routine/patient/diagnose/report/adjuvantBreast/option")
    @ApiOperation("获取新辅后乳腺癌选项")
    public RoutinePatientDiagnoseReportAdjuvantBreastOptionVo getAdjuvantBreastOption() {
        return service.getAdjuvantBreastOption();
    }

    @Response
    @GetMapping("/routine/patient/diagnose/report/prostate/option")
    @ApiOperation("获得前列腺癌报告选项")
    public RoutinePatientDiagnoseReportProstateOptionVo getProstateOption() {
        return service.getProstateOption();
    }

    @Response
    @GetMapping("/routine/patient/diagnose/report/bladder/option")
    @ApiOperation("获得膀胱癌报告选项")
    public RoutinePatientDiagnoseReportBladderOptionVo getBladderOption() {
        return service.getBladderOption();
    }

    @Response
    @GetMapping("/routine/patient/diagnose/report/colloid/option")
    @ApiOperation("获得胶质瘤报告选项")
    public RoutinePatientDiagnoseReportColloidOptionVo getColloidOption() {
        return service.getColloidOption();
    }

}